# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Spanner.V1.Model.KeyRangeInfo do
  @moduledoc """
  A message representing information for a key range (possibly one key).

  ## Attributes

  *   `contextValues` (*type:* `list(GoogleApi.Spanner.V1.Model.ContextValue.t)`, *default:* `nil`) - The list of context values for this key range.
  *   `endKeyIndex` (*type:* `integer()`, *default:* `nil`) - The index of the end key in indexed_keys.
  *   `info` (*type:* `GoogleApi.Spanner.V1.Model.LocalizedString.t`, *default:* `nil`) - Information about this key range, for all metrics.
  *   `keysCount` (*type:* `String.t`, *default:* `nil`) - The number of keys this range covers.
  *   `metric` (*type:* `GoogleApi.Spanner.V1.Model.LocalizedString.t`, *default:* `nil`) - The name of the metric. e.g. "latency".
  *   `startKeyIndex` (*type:* `integer()`, *default:* `nil`) - The index of the start key in indexed_keys.
  *   `timeOffset` (*type:* `String.t`, *default:* `nil`) - The time offset. This is the time since the start of the time interval.
  *   `unit` (*type:* `GoogleApi.Spanner.V1.Model.LocalizedString.t`, *default:* `nil`) - The unit of the metric. This is an unstructured field and will be mapped as is to the user.
  *   `value` (*type:* `number()`, *default:* `nil`) - The value of the metric.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :contextValues => list(GoogleApi.Spanner.V1.Model.ContextValue.t()) | nil,
          :endKeyIndex => integer() | nil,
          :info => GoogleApi.Spanner.V1.Model.LocalizedString.t() | nil,
          :keysCount => String.t() | nil,
          :metric => GoogleApi.Spanner.V1.Model.LocalizedString.t() | nil,
          :startKeyIndex => integer() | nil,
          :timeOffset => String.t() | nil,
          :unit => GoogleApi.Spanner.V1.Model.LocalizedString.t() | nil,
          :value => number() | nil
        }

  field(:contextValues, as: GoogleApi.Spanner.V1.Model.ContextValue, type: :list)
  field(:endKeyIndex)
  field(:info, as: GoogleApi.Spanner.V1.Model.LocalizedString)
  field(:keysCount)
  field(:metric, as: GoogleApi.Spanner.V1.Model.LocalizedString)
  field(:startKeyIndex)
  field(:timeOffset)
  field(:unit, as: GoogleApi.Spanner.V1.Model.LocalizedString)
  field(:value)
end

defimpl Poison.Decoder, for: GoogleApi.Spanner.V1.Model.KeyRangeInfo do
  def decode(value, options) do
    GoogleApi.Spanner.V1.Model.KeyRangeInfo.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.KeyRangeInfo do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
